package cn.sm.controller;

import cn.sm.domain.User;
import cn.sm.service.IUserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: mayuanbao
 * @Date: 2018-12-01 15:23
 * @Description:
 */
@RestController
public class UserController {
    @Resource(name = "userService")
    private IUserService service;

    @RequestMapping(value = "/save")
    public int save(User user) {
        if (user.getId() != null) {
            return service.save(user);
        }
        return 0;
    }

    @RequestMapping(value = "/query")
    public List<User> query(String id) {
        return service.query(id);
    }
}
